package Q3;

import java.util.Scanner;

public class Main {

    public static int n;
    public static char[] ch;
    public static int ret;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        n = scanner.nextInt();
        String str = scanner.next();
        ch = str.toCharArray();

        dfs(0, new StringBuilder());

        System.out.println(ret);
    }

    public static void dfs(int index, StringBuilder stringBuilder) {
        if (stringBuilder.length() == 3) {
            String str = stringBuilder.toString();
            if (str.charAt(1) == str.charAt(2) && str.charAt(0) != str.charAt(1)) {
                ret++;
            }

            return;
        }

        if (index == n) {
            return;
        }

        //选
        stringBuilder.append(ch[index]);
        dfs(index + 1, stringBuilder);
        //回溯
        stringBuilder.deleteCharAt(stringBuilder.length() - 1);

        //不选
        dfs(index + 1, stringBuilder);
    }
}
